import React, { PureComponent } from 'react';
import { StyleSheet, View, Text, Image, ViewPropTypes } from 'react-native';
import screen from '../../common/screen'
type Props = {
  Title: String,
  Desc: String,
  TitleStyle?: ViewPropTypes.style,   //?是可选意思
  DescStyle?: ViewPropTypes.style,   //?是可选意思
}
type State = {

}

class HomeGridItem extends PureComponent<Props, State> {
  constructor(props) {
    super(props);
    this.state = {
    };
  }

  render () {
    let { Title, Desc , TitleStyle, DescStyle} = this.props
    return (
      <View style={styles.item}>
        <View style={styles.itemWrap}>
          <View style={styles.itemWrapTitle}>
            <Text style={[styles.title, TitleStyle]}>{Title}</Text>
            <Text style={[styles.desc, DescStyle]}>{Desc}</Text>
          </View>
          <Image style={styles.img} source={require('../../img/home/icon_homepage_life_service_category.png')} />
        </View>
      </View>
    );
  }
}
const ItenWidth = screen.width / 2
const border = 3
const styles = StyleSheet.create({
  item: {
    height: 100,
    backgroundColor: '#ffffff',
    width: ItenWidth - border,
    marginRight: border,
    marginBottom: border,
  },
  itemWrap: {
    width: ItenWidth - border,
    height: 100,
    flexDirection: 'row',
    flexWrap: 'wrap',
    justifyContent: 'center',
    alignItems: 'center',
  },
  itemWrapTitle: {
    width: 100
  },
  img: {
    width: 65,
    height: 65
  },
  title: {
    fontSize: 18
  },
  desc: {
    fontSize: 16
  }
})
export default HomeGridItem;